package com.sise.foodplatform.controller;

import com.sise.foodplatform.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class OssController {

    //到时oss上传可以用新的模块，然后会有新的端口。多个模块就有多个端口
    //利用nginx实现负载均衡，通过配置监听端口和匹配路径，根据不同的请求访问路径转发到不同服务器
    @Autowired
    private OssService ossService;

    @RequestMapping("/fileoss")
    public String uploadOssFile(MultipartFile file){
        //获取上传文件 MultipartFile
        //返回上传到oss的路径
        String url = ossService.uploadFileImage(file);
        return url;
    }
}
